<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>常见问题解答</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
</head>
<body>

<div class="container" style="width:96%">
	<table class="table table-bordered table-striped" align="center">
		<tr>
			<td>
				<nav class="navbar navbar-default">
					<div class="navbar-header">
						<span class="navbar-brand">常见问题解答</span>
					</div>
				</nav>
			</td>
		</tr>
	</table>
	<form action="" method="post">
		<table class="table table-bordered table-striped" align="center">
			<thead>
			<tr>
				<th width="50%">问题</th>
				<th>答案</th>
			</tr>
			</thead>
			<tbody>
			{foreach $list as $v}
			<tr>
				<td>
					<div class="form-inline">
						<input type="text" class="form-control " name="title[]" value="{$v.Title}" style="width: 85%"/>
						<input type="button" class="btn btn-info" onclick="addCode($(this))" value="+" style="width: 4%; margin-left: 1%"/>
						<input type="button" class="btn btn-info" onclick="delCode($(this))" value="-" style="width: 4%; margin-left: 1%"/>
					</div>
				</td>
				<td>
					<textarea class="form-control" rows="5" name="text[]">{$v.Text}</textarea>
				</td>
			</tr>
			{/foreach}
			<tr id="after-list">
				<td class="text-center" colspan="2">
					<input type="button" id="add-faq" class="btn btn-success" value="新增" style="margin-right: 200px"/>
					<input type="submit" class="btn btn-primary" value="保存" style="margin-right: 200px"/>
					<input type="reset" class="btn btn-primary" value="重置"/>
				</td>
			</tr>
			</tbody>
		</table>
	</form>
</div>
<script type="application/javascript">
	var tpl = '<tr><td><div class="form-inline"><input type="text" class="form-control " name="title[]" value="" style="width: 85%"/><input type="button" class="btn btn-info" onclick="addCode($(this))" value="+" style="width: 4%; margin-left: 1%"/><input type="button" class="btn btn-info" onclick="delCode($(this))" value="-" style="width: 4%; margin-left: 1%"/></div></td><td><textarea class="form-control" rows="5" name="text[]"></textarea></td></tr>';
	$('#add-faq').on('click', function () {
		$('#after-list').before(tpl);
    });
	function addCode(obj) {
		obj.parent().parent().parent().before(tpl);
    }
    function delCode(obj) {
        obj.parent().parent().parent().remove();
    }
</script>

</body>
<html>